package com.muzuo.pdf.control;

import io.swagger.annotations.Api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.muzuo.pdf.entity.User;
import com.muzuo.pdf.service.IPdfService;

import java.util.Date;

/**
 * 
 * @ClassName: IndexControl
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author muzuo
 * @date 2020年12月27日
 *
 */
@Api("测试生成PDF")
@Controller
public class IndexControl {
    @Autowired
    IPdfService pdfService;
    
    
    @PostMapping("/index")
    @ResponseBody
    public boolean index(User user){

        int a =100;
        int b= 200;


        return pdfService.createPdf(user);
    }


    @GetMapping("/newPdf")
    @ResponseBody
    public boolean newPdf(User user){

        int a =100;
        int b= 200;



        User infoUser= new User();

        infoUser.setRegisterTime(new Date());
        infoUser.setMobile("18654165783");
        infoUser.setName("赵益民");
        infoUser.setSex(1);
        infoUser.setAddress("工作计划及地址");

        if(null!=user.getName()) {
            infoUser.setName(user.getName());

        }
        return pdfService.createPdf(infoUser);
    }
}
